<script setup>
import { onLaunch } from '@dcloudio/uni-app'
import { getToken } from './utils/auth'
import { redirectToLogin } from '@/utils/index'

onLaunch(async () => {
  try {
    // const token = getToken()
    // if (token) {
    //   uni.navigateTo({
    //     url: '/pages/product/index'
    //   })
    // } else {
    //   redirectToLogin()
    // }
  } finally {
    uni.hideLoading()
  }
  // #ifdef MP-WEIXIN
  uni?.getPrivacySetting({
    success(res) {
      // eslint-disable-next-line no-console
      console.log(
        res,
        '是否需要授权：',
        res.needAuthorization,
        '隐私协议的名称为：',
        res.privacyContractName
      )
      if (res.needAuthorization) {
        uni.setStorageSync('privacyContractName', res.privacyContractName)
        uni.setStorageSync('showPrivacy', true)
      } else {
        uni.setStorageSync('showPrivacy', false)
      }
    }
  })
  // #endif
})
</script>

<style lang="scss">
@import 'yun-vk-uview-ui/index.scss';
@import './static/iconfont/yun-iconfont.css';

.u-btn {
  outline: none;
  &--info::after {
    border: none !important;
  }
}
.u-size-mini {
  background-color: #04b27c !important;
  border-radius: 8rpx !important;
  padding: 10rpx 32rpx !important;
}
</style>
